﻿namespace Centido.Core.Test
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    /// <summary>
    /// Testing integer table column
    /// </summary>
    [TestClass]
    public class IntColumnTest : ColumnBaseTest<int?>
    {
        /// <summary>
        /// Integer table column
        /// </summary>
        // ReSharper disable UnusedMember.Local
        private IntColumn Column
        // ReSharper restore UnusedMember.Local
        {
            get { return GenericColumn as IntColumn; }
        }

        /// <summary>
        /// Get column type
        /// </summary>
        /// <returns></returns>
        protected override ColumnType GetColumnType()
        {
            return ColumnType.Integer;
        }

        /// <summary>
        /// Get large value
        /// </summary>
        /// <returns></returns>
        protected override int? GetLargeValue()
        {
            return 1147483647;
        }

        /// <summary>
        /// Get small data
        /// </summary>
        /// <returns></returns>
        protected override int? GetSmallValue()
        {
            return -1147483647;
        }

        /// <summary>
        /// Convert db value
        /// </summary>
        /// <param name="dbValue">Db value</param>
        /// <returns></returns>
        protected override int? ConvertDbValue(object dbValue)
        {
            return DbValue.GetInteger(dbValue);
        }
    }
}